<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<title>个人信息</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
</head>
  
<body>
<div class="container-fluid p-t-15">
  
  <div class="row">
    <div class="col-lg-12">
      <div class="card">
        <div class="card-body">
          
          <form class="site-form">
            <div class="form-group">
              <label for="username">用户名</label>
              <input type="text" class="form-control" name="username" id="username"  disabled="disabled"/>
            </div>
						
						<div class="form-group">
							<label for="education">学历</label>
							<input type="text" class="form-control" name="education" id="education" disabled="disabled"/>
						</div>
						
						<div class="form-group">
							<label for="phone">电话</label>
							<input type="text" class="form-control" name="phone" id="phone"/>
						</div>
						
						<div class="form-group">
							<label for="address">住址</label>
							<input type="text" class="form-control" name="address" id="address"/>
						</div>
						
						<div class="form-group">
							<label for="department">部门</label>
							<input type="text" class="form-control" name="department" id="department" disabled="disabled"/>
						</div>
           
            <button id="submit2" class="btn btn-primary">保存</button>
          </form>
 
        </div>
      </div>
    </div>
    
  </div>
  
</div>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
		$("#submit2").click(function(){
			/* 
			var phone = document.getElementById("phone");
      var address = document.getElementById("address");
			var list = {"phone":phone,"address":address};
        //
        $.ajax({
            //请求方式
            type : "POST",
            //请求的媒体类型
            contentType: "application/json;charset=UTF-8",
            //请求地址
            url : "http://127.0.0.1:8080/user/edit",
            //数据，json字符串
            data : JSON.stringify(list),
            //请求成功
            success : function(result) {
                console.log(result);
								document.getElementById("username").value=result.username;
                document.getElementById("phone").value=result.phone;
// 								$('#education').var(result.education);
// 								$('#address').var(result.address);
// 								$('#department').var(result.department);
            }            
        }); */
      var phone = document.getElementById("phone");
      var address = document.getElementById("address");
      var xml = window.XMLHttpRequest
        ? new XMLHttpRequest()
        : ActiveXObject("microsoft.XMLHttp");
      xml.open("post", "http://localhost:8080/user/edit", true);
      xml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xml.send("phone=" + phone + "&address=" + address);
      xml.onreadystatechange = function() {
        if (xml.readyState == 4 && xml.status == 200) {
          var x = xml.responseText;
          var itme = JSON.parse(xml.responseText);
          self.flag = itme.flag;         
        }
      };
		});
</script>
</body>
</html>